package customer

import "time"

type CustomerPo struct {
	Id                int64     `gorm:"primaryKey" json:"id"`
	CompanyName       string    `gorm:"type:varchar(255);not null;default:''" json:"company_name"`
	OrganizingCode    string    `gorm:"type:varchar(128);not null;default:''" json:"organizing_code"`
	TopCompanyName    string    `gorm:"type:varchar(255);not null;default:''" json:"top_company_name"`
	TopOrganizingCode string    `gorm:"type:varchar(128);not null;default:''" json:"top_organizing_code"`
	CompanyLogo       string    `gorm:"type:varchar(255);not null;default:''" json:"company_logo"`
	Province          string    `gorm:"type:varchar(16);not null;default:''" json:"province"`
	ProvinceCode      string    `gorm:"type:varchar(16);not null;default:''" json:"province_code"`
	City              string    `gorm:"type:varchar(16);not null;default:''" json:"city"`
	CityCode          string    `gorm:"type:varchar(16);not null;default:''" json:"city_code"`
	Group             string    `json:"group"`
	BusinessStatus    string    `gorm:"type:varchar(40);not null;default:''" json:"business_status"`
	CompanyType       string    `gorm:"type:varchar(40);not null;default:''" json:"company_type"`
	CreditLevel       string    `gorm:"type:varchar(40);not null;default:''" json:"credit_level"`
	ResponsibleUserID int64     `gorm:"not null;default:0" json:"responsible_user_id"`
	HasProfile        int32     `gorm:"type:tinyint(2);not null;default:0" json:"has_profile"`
	YcgCompanyId      string    `json:"ycg_company_id"`
	Source            int32     `gorm:"not null;default:0" json:"source"`
	FromDevice        string    `gorm:"type:varchar(16);not null;default:'PC'" json:"from_device"`
	CreatedBy         int64     `gorm:"not null;default:0" json:"created_by"`
	CreatedOn         time.Time `gorm:"type:datetime;not null;default:current_timestamp" json:"created_on"`
	ModifiedBy        int64     `gorm:"not null;default:0" json:"modified_by"`
	ModifiedOn        time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp" json:"modified_on"`
	IsDeleted         int32     `gorm:"type:tinyint(1);not null;default:0" json:"is_deleted"`
}

// TableName 客户主表
func (p CustomerPo) TableName() string {
	return "gfyx_customer"
}

type CustomerGroupPo struct {
	Id         int64     `gorm:"primaryKey" json:"id"`
	CustomerId int64     `gorm:"not null;default:0" json:"customer_id"`
	GroupName  string    `gorm:"type:varchar(40);not null;default:''" json:"group_name"`
	CreatedBy  int64     `gorm:"not null;default:0" json:"created_by"`
	CreatedOn  time.Time `gorm:"type:datetime;not null;default:current_timestamp" json:"created_on"`
	ModifiedBy int64     `gorm:"not null;default:0" json:"modified_by"`
	ModifiedOn time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp" json:"modified_on"`
	IsDeleted  int32     `gorm:"type:tinyint(1);not null;default:0" json:"is_deleted"`
}

// TableName 客户分组表
func (p CustomerGroupPo) TableName() string {
	return "gfyx_customer_group"
}

type CustomerIndexPo struct {
	Id                        int64     `gorm:"primaryKey" json:"id"`
	CustomerId                int64     `gorm:"not null;default:0" json:"customer_id"`
	ClueCnt                   int64     `gorm:"type:int(10);" json:"clue_cnt"`
	ReportCnt                 int64     `gorm:"type:int(10);" json:"report_cnt"`
	BidCount2Year             int32     `gorm:"column:bid_cnt_2year" json:"bid_cnt_2year"`
	TakeLandCount2Year        int32     `gorm:"column:take_land_cnt_2year" json:"take_land_cnt_2year"`
	CommencePermitCount2Year  int32     `gorm:"column:commence_permit_cnt_2year" json:"commence_permit_cnt_2year"`
	SellProjectCount2Year     int32     `gorm:"column:sell_project_cnt_2year" json:"sell_project_cnt_2year"`
	CooperationCaseCount2Year int32     `gorm:"column:cooperation_case_cnt_2year" json:"cooperation_case_cnt_2year"`
	CreatedBy                 int64     `gorm:"not null;default:0" json:"created_by"`
	CreatedOn                 time.Time `gorm:"type:datetime;not null;default:current_timestamp" json:"created_on"`
	ModifiedBy                int64     `gorm:"not null;default:0" json:"modified_by"`
	ModifiedOn                time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp" json:"modified_on"`
	IsDeleted                 int32     `gorm:"type:tinyint(1);not null;default:0" json:"is_deleted"`
}

// TableName 设置表名
func (p CustomerIndexPo) TableName() string {
	return "gfyx_customer_index"
}

type CustomerTagPo struct {
	Id              int64     `gorm:"primaryKey" json:"id"`
	CustomerId      int64     `gorm:"not null;default:0" json:"customer_id"`
	CompanyLabel    string    `gorm:"type:varchar(500);not null;default:''" json:"company_label"`
	CompanyIdentity string    `gorm:"type:varchar(500);not null;default:''" json:"company_identity"`
	CompanyLevel    string    `gorm:"type:varchar(500);not null;default:''" json:"company_level"`
	CreatedBy       int64     `gorm:"not null;default:0" json:"created_by"`
	CreatedOn       time.Time `gorm:"type:datetime;not null;default:current_timestamp" json:"created_on"`
	ModifiedBy      int64     `gorm:"not null;default:0" json:"modified_by"`
	ModifiedOn      time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp" json:"modified_on"`
	IsDeleted       int32     `gorm:"type:tinyint(1);not null;default:0" json:"is_deleted"`
}

// TableName 设置表名
func (p CustomerTagPo) TableName() string {
	return "gfyx_customer_tag"
}

type CustomerImportPo struct {
	Id                  int64     `gorm:"primaryKey" json:"id"`
	FileId              int64     `gorm:"not null;default:0" json:"file_id"`
	CompanyName         string    `gorm:"type:varchar(500);not null;default:''" json:"company_name"`
	ResponsibleUserName string    `gorm:"type:varchar(500);not null;default:''" json:"responsible_user_name"`
	ResponsibleUserId   int64     `json:"responsible_user_id"`
	CustomerGroup       string    `gorm:"type:varchar(500);not null;default:''" json:"customer_group"`
	Status              int32     `json:"status"`
	Remark              string    `gorm:"type:varchar(500);not null;default:''" json:"remark"`
	CreatedBy           int64     `gorm:"not null;default:0" json:"created_by"`
	CreatedOn           time.Time `gorm:"type:datetime;not null;default:current_timestamp" json:"created_on"`
	ModifiedBy          int64     `gorm:"not null;default:0" json:"modified_by"`
	ModifiedOn          time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp" json:"modified_on"`
	IsDeleted           int32     `gorm:"type:tinyint(1);not null;default:0" json:"is_deleted"`
}

func (p CustomerImportPo) TableName() string {
	return "gfyx_customer_import"
}

type CustomerListItemPo struct {
	// 近两年招标数
	BidCnt2Year int32 `gorm:"column:bid_cnt_2year" json:"bid_cnt_2year,omitempty"`
	// 经营状态
	BusinessStatus string `json:"business_status"`
	// 城市名称
	City string `json:"city,omitempty"`
	// 城市code
	CityCode string `json:"city_code,omitempty"`
	// 线索总数
	ClueCnt int32 `json:"clue_cnt,omitempty"`
	// 近两年开工数
	CommencePermitCnt2Year int32 `gorm:"column:commence_permit_cnt_2year" json:"commence_permit_cnt_2year,omitempty"`
	// 企业性质
	CompanyIdentity string `json:"company_identity"`
	// 企业标签
	CompanyLabel string `json:"company_label,omitempty"`
	// 企业等级
	CompanyLevel string `json:"company_level,omitempty"`
	// 公司 logo
	CompanyLogo string `json:"company_logo"`
	// 客户公司名称
	CompanyName string `json:"company_name"`
	// 企业类型
	CompanyType string `json:"company_type"`
	// 合作案例数
	CooperationCaseCnt2Year int32 `gorm:"column:cooperation_case_cnt_2year" json:"cooperation_case_cnt_2year,omitempty"`
	// 创建人
	CreatedBy         int64  `json:"created_by,omitempty"`
	CreatedByUserName string `json:"created_by_user_name"`
	// 创建时间
	CreatedOn time.Time `json:"created_on,omitempty"`
	// 信用等级
	CreditLevel string `json:"credit_level,omitempty"`
	// 客户分组
	Group string `json:"group"`
	// 客户id
	Id int64 `json:"id"`
	// 客户公司名称信用代码
	OrganizingCode string `json:"organizing_code"`
	// 省份名称
	Province string `json:"province,omitempty"`
	// 省份code
	ProvinceCode string `json:"province_code,omitempty"`
	// 报备总数
	ReportCnt int32 `json:"report_cnt,omitempty"`
	// 负责人姓名
	ResponsibleUserID int64 `json:"responsible_user_id,omitempty"`
	// 负责人名称
	ResponsibleUserName string `json:"responsible_user_name,omitempty"`
	// 开盘数
	SellProjectCnt2Year int32 `gorm:"column:sell_project_cnt_2year" json:"sell_project_cnt_2year,omitempty"`
	// 近两年拿地数
	TakeLandCnt2Year int32 `gorm:"column:take_land_cnt_2year" json:"take_land_cnt_2year,omitempty"`
	// 顶级公司名称
	TopCompanyName string `json:"top_company_name"`
	// 顶级公司信用代码
	TopCompanyOrganizingCode string `json:"top_company_organizing_code"`
	// 平台公司ID
	YcgCompanyId string `json:"ycg_company_id"`
}
